package com.ruoyi.mp.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.db.domain.system.PcProCombo;
import com.ruoyi.mp.service.IPcProComboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【产品套餐】Controller
 * 
 * @author ruoyi
 * @date 2022-07-23
 */
@Api(value = "【产品套餐】",tags ="【产品套餐】")
@RestController
@RequestMapping("/mp/proCombo")
public class PcProComboController extends BaseController
{
    private static Logger log = LoggerFactory.getLogger(PcProComboController.class);
    @Autowired
    private IPcProComboService pcProComboService;

    /**
     * 查询【产品套餐】列表
     */
    @ApiOperation(value = "查询【产品套餐】列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name="pcProCombo",value="【产品套餐】",paramType="form")
    })
    @GetMapping("/list")
    public TableDataInfo list(PcProCombo pcProCombo)
    {
        try {
            startPage();
            List<PcProCombo> list = pcProComboService.selectPcProComboList(pcProCombo);
            return getDataTable(list);
        }catch (Exception e){
            log.error("【产品套餐】发生异常",e);
        }
        return null;
    }

    /**
     * 获取【产品套餐】详细信息
     */
    @ApiOperation(value = "获取【产品套餐】详细信息")
    @ApiImplicitParam(name="proComboId",value="【产品套餐】")
    @GetMapping(value = "/{proComboId}")
    public AjaxResult getInfo(@PathVariable("proComboId") Long proComboId)
    {
        try {
            return AjaxResult.success(pcProComboService.selectPcProComboByProComboId(proComboId));
        }catch (Exception e){
            log.error("【产品套餐】发生异常",e);
        }
        return AjaxResult.error("【产品套餐】异常");
    }

}
